﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>$CreationDate$</CreationDate>
</File>
*/
#endregion

using System;
using System.IO;
using System.Threading.Tasks;

#if WINDOWS_UWP || NETFX_CORE
using Windows.Storage;
#else
using System.Windows;
#endif

namespace Outcoder.Data
{
	public static class ApplicationResourceUtility
	{
#if WINDOWS_UWP || NETFX_CORE
		public static async Task<Stream> GetApplicationResourceStreamAsync(Uri resourceUri)
		{
			StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(resourceUri);
			Stream resourceStream = await file.OpenStreamForReadAsync();
			return resourceStream;
		}
#else
		public static async Task<Stream> GetApplicationResourceStreamAsync(Uri resourceUri)
		{
			Stream resourceStream = Application.GetResourceStream(resourceUri).Stream;
			return resourceStream;
		}
#endif
	}
}
